package com.zjhcsoft.auth.controller;


import com.zjhcsoft.auth.common.vo.Result;
import com.zjhcsoft.auth.entity.web.QueryCheckTypesRequest;
import com.zjhcsoft.auth.entity.web.QueryCorporationRequest;
import com.zjhcsoft.auth.entity.web.QueryCredentialRequest;
import com.zjhcsoft.auth.entity.web.QueryDeviceRequest;
import com.zjhcsoft.auth.entity.web.QueryUserInfoRequest;
import com.zjhcsoft.auth.entity.web.UpdateCheckTypeRequest;
import com.zjhcsoft.auth.entity.web.UpdateCredentialRequest;
import com.zjhcsoft.auth.entity.web.UpdateDeviceRequest;
import com.zjhcsoft.auth.entity.web.UpdateMobileRequest;
import com.zjhcsoft.auth.entity.web.UpdatePasswordRequest;
import com.zjhcsoft.auth.service.AccountService;
import com.zjhcsoft.auth.service.PasswordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * <p>
 * 账号表 前端控制器
 * </p>
 *
 * @author wzya
 * @since 2021-03-29
 */
@Controller
@RequestMapping("/account")
@Api("账户管理接口控制器")
public class AccountController {

    @Autowired
    AccountService accountService;
    @Autowired
    PasswordService passwordService;

    @PostMapping("/update/mobile")
    @ResponseBody
    @ApiOperation(value="重新绑定手机号")
    public Result updateMobile(UpdateMobileRequest request) {
        return accountService.updateMobile(request);
    }

    @PostMapping("/update/device")
    @ResponseBody
    @ApiOperation(value="设备绑定")
    public Result updateDevice(UpdateDeviceRequest request) {
        return accountService.updateDevice(request);
    }

    @PostMapping("/query/device")
    @ResponseBody
    @ApiOperation(value="查询绑定设备列表")
    public Result queryDevice(QueryDeviceRequest request) {
        return accountService.queryDevice(request);
    }

    @PostMapping("/update/password")
    @ResponseBody
    @ApiOperation(value="修改密码")
    public Result updatePassword(UpdatePasswordRequest request) {
        return accountService.updatePassword(request);
    }

    @PostMapping("/query/check_type")
    @ResponseBody
    @ApiOperation(value="密码校验方式查询")
    public Result queryCheckType(QueryCheckTypesRequest request) {
        return accountService.queryCheckType(request);
    }

    @PostMapping("/update/check_type")
    @ResponseBody
    @ApiOperation(value="开启/关闭密码校验方式")
    public Result updateCheckType(UpdateCheckTypeRequest request) {
        return accountService.updateCheckType(request);
    }

    @PostMapping("/query/credential")
    @ResponseBody
    @ApiOperation(value="登录方式查询")
    public Result queryCredential(QueryCredentialRequest request) {
        return accountService.queryCredential(request);
    }

    @PostMapping("/update/credential")
    @ResponseBody
    @ApiOperation(value="登录方式开启/关闭")
    public Result updateCredential(UpdateCredentialRequest request) {
        return accountService.updateCredential(request);
    }

    @PostMapping("/query/userinfo")
    @ResponseBody
    @ApiOperation(value="用户信息查询")
    public Result queryUserInfo(QueryUserInfoRequest request) {
        return accountService.queryUserInfo(request);
    }

    @PostMapping("/query/corporation")
    @ResponseBody
    @ApiOperation(value="多法人信息查询")
    public Result queryCorporation(QueryCorporationRequest request) {
        return accountService.queryCorporation(request);
    }

    @PostMapping("/device/certificate")
    @ResponseBody
    @ApiOperation(value="设备安全认证")
    public Result deviceCertificate( ) {
        //TODO..
        return Result.ok();
    }

    @PostMapping("/password/complexity/certificate")
    @ResponseBody
    @ApiOperation(value="密码复杂度校验")
    public Result passwordComplexityCertificate(String password ) {
        //TODO..
        return Result.ok(passwordService.passwordComplexityValidate(password));
    }



}

